import request from '@/utils/request';

export function getTodoTaskPage(data) {
  return request({
    url: '/bpm/process-instance/todo-page',
    method: 'post',
    data,
  });
}

export function getDoneTaskPage(data) {
  return request({
    url: '/bpm/process-instance/done-page',
    method: 'post',
    data,
  });
}

export function completeTask(data) {
  return request({
    url: '/bpm/task/complete',
    method: 'PUT',
    data,
  });
}

export function approveTask(data) {
  return request({
    url: '/bpm/task/approve',
    method: 'PUT',
    data,
  });
}

export function rejectTask(data) {
  return request({
    url: '/bpm/task/reject',
    method: 'PUT',
    data,
  });
}
export function backTask(data) {
  return request({
    url: '/bpm/task/back',
    method: 'PUT',
    data,
  });
}

export function updateTaskAssignee(data) {
  return request({
    url: '/bpm/task/update-assignee',
    method: 'PUT',
    data,
  });
}

export function getTaskListByProcessInstanceId(processInstanceId) {
  return request({
    url: `/bpm/task/list-by-process-instance-id?processInstanceId=${processInstanceId}`,
    method: 'get',
  });
}
